package com.iocaop.security.demo01.config;

import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

import java.beans.Customizer;
// 打印调试日志 logging也为debug时可用
@EnableWebSecurity(debug = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter {
    /**
     * 权限
     * @param http
     * @throws Exception
     */
    @Override protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable();
    }

    /**
     *
     * @param web
     * @throws Exception
     */
    @Override public void init(WebSecurity web) throws Exception {
        // 匹配到的路径将不经过过滤器链
        web.ignoring().mvcMatchers("/public/**/");
    }

    /**
     * 认证配置
     * @param auth
     * @throws Exception
     */
    @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception {

    }
}
